#include "Md.h"
#include <iostream>	
#include <fstream>

int main()
{
	cout<<"该行情接口的版本是："<<GetMdApiVersion()<<endl;

    /*创建行情API对象，传入日志路径*/
	CHSMdApi* lpMdApi = NewMdApi("./log/");

    /*创建行情SPI对象并注册到行情API*/
	CMdSpi* lpMdSpi = new CMdSpi(lpMdApi);
    
	lpMdApi->RegisterSpi(lpMdSpi);

    /*注册前置地址
    /*连接UFT系统时地址前缀为tcp://
    /*连接UST系统时地址前缀为ust://
    */
    // 西部仿真环境 UFT柜台
    cout << "连接行情前置：tcp://101.230.91.197:7200" << endl;
    lpMdApi->RegisterFront("tcp://101.230.91.197:7200");
    // 恒生提供的公共测试环境，经测，可收到指数、ETF、及期权行情
    // cout << "连接行情前置：tcp://121.41.138.11:9869" << endl;
    // lpMdApi->RegisterFront("tcp://121.41.138.11:9869");
    // 西部实盘环境
    // cout << "连接行情前置：tcp://140.206.149.114:7080" << endl;
    // lpMdApi->RegisterFront("tcp://140.206.149.114:7080");
    
    

    /*行情API 初始化
    /*连接UFT系统时传入许可证路径
    /*连接UST系统时无需许可证
    */
	int iRet = lpMdApi->Init("license_xbqh_sim.dat");
	if (iRet != SDK_OK)
	{
		printf(lpMdApi->GetApiErrorMsg(iRet));
	}
	lpMdApi->Join();

	return 0;
}

